#ifndef __READPAIR__
#define __READPAIR__
#include <fstream>
#include <string>
#include <stdio.h>
#include <vector>

using namespace std;

struct spread{
  spread():lasttradetime(0),master(),slave(),unit(0),s_threshold(0),liq_upper(0),liq_lower(0),l_threshold(0){}
  string master;
  string slave;
  int unit;

  double s_threshold;
  double liq_upper;
  double liq_lower;
  double l_threshold;

  time_t lasttradetime;
  //void increase(double v,bool ismaster);
};

spread str2spread(string s);


vector<spread> getspreadinfo(const string& pairfile);

//int main(int argc, char* argv[]){
//  getspreadinfo("pairs.csv");
//  return 0;
//}

//#define BIDASKSPREAD 0.179685
#define BIDASKSPREAD 0

/*
$grep spread  trade.log |egrep -v "\-"|awk -F: '{print $2,$3}' |awk '{print $1-$3}'|grep -v '-' |awk '{x+=$1}END{pr                                                                                                                          int x,x/NR,NR}'
427.47 0.179685 2379
*/

#endif